package com.xuecheng.system.convent;

import com.xuecheng.api.system.model.dto.DictionaryDTO;
import com.xuecheng.system.entity.Dictionary;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

import java.util.List;

@Mapper
public interface DictionaryConvent {

    // 帮我们生成CourseBaseConvert接口的实现类,实现类不需要我我们书写了
    DictionaryConvent INSTANCE= Mappers.getMapper(DictionaryConvent.class);

    /**
     * todo 将po转成DTO
     * @Mappings    可以添加多个@Mapping(source = "id",target = "courseBaseId")
     * @Mapping(source = "id",target = "courseBaseId")   表示对传入传出参数不同属性名进行标注 source传入参数属性名   target传出参数属性名
     * @param dictionary     传入参数
     * @return CourseBaseDTO    传出参数
     */
    @Mappings({
            @Mapping(source = "id",target = "dicId")
    })
    DictionaryDTO entity2dto(Dictionary dictionary);

    /**
     * todo 将pos转成DTOs
     * @param dictionary
     * @return
     */
    List<DictionaryDTO> entitys2dtos(List<Dictionary> dictionary);
}
